import React, { Component } from 'react'

import {withRouter} from 'react-router-dom'

class BackHome extends Component {

    goHome = () => {
        this.props.history.push({
            pathname: '/home',
            state: {
                id: this.props.match.params.id
            }
        })
    }

    render() {
        console.log("加了withRouter高阶组件以后的props=",this.props)
        return (
            <button onClick={this.goHome}>返回首页</button>
        )
    }
}
export default withRouter(BackHome)